import { CALC_INCREMENT, CALC_DECREMENT } from '../constants'
export default function calc(state = 10, action) {
  // reducer 是干活的
  // 根据 action 处理 state，并把处理完后的结果返回
  switch (action.type) {
    case CALC_INCREMENT:
      return state + action.payload
    case CALC_DECREMENT:
      return state - action.payload
    default:
      return state
  }
}
